import { createRouter, createWebHashHistory } from 'vue-router'

const routes = [
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/login')
  },
  {
    path: '/',
    name: '/',
    component: () => import('../layout'),

    children: [
      {
        path: 'home',
        name: 'home',
        component: () => import('@/views/home/index.vue'),
        redirect: '/'
      },
      {
        path: 'article',
        name: '文章管理',
        component: () => import('@/views/article/index.vue')
      },
      {
        path: 'sort',
        name: '文章分类管理',
        component: () => import('@/views/article/sort.vue')
      },
      {
        path: 'product',
        name: '产品列表',
        component: () => import('@/views/product/index.vue')
      }
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
